<?php

class Ext_Config
{
    protected static $_instance = null;

    protected $_config = array();

    protected function __construct()
    {}

    protected function __clone()
    {}

    public static function getInstance()
    {
        if (null === self::$_instance) {
            self::$_instance = new self();
        }

        return self::$_instance;
    }

    public function getConfig($name)
    {
        if (!isset($this->_config[$name])) {
            $this->setConfig($name);
        }

        return $this->_config[$name];
    }

    public function setConfig($name)
    {
        $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/'.$name.'.ini', APPLICATION_ENV);
        if($config){
            $this->_config[$name] = $config;
        }
    }
}
